    //
    //  Ordersignle.m
    //  ZYShang
    //
    //  Created by wangguangming on 15/7/27.
    //  Copyright © 2015年 Amber. All rights reserved.
    //

#import "Ordersignle.h"
#import "Base.h"
#import "Reachability.h"
static Ordersignle *signle=nil;

@implementation Ordersignle
+(Ordersignle *)single
{
    if (signle==nil)
        {
        signle=[[Ordersignle alloc] init];
        }
    return signle;
}
-(void)waitDistributionsworking
{
    
    NSString *urlString=[NSString stringWithFormat:@"%@/api/zls/orders/topicked?from=s&start=0&count=100",URL];
    NSURL *url=[NSURL URLWithString:urlString];
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
    
    
    [request setHTTPShouldHandleCookies:YES];
    
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *respose,NSData *data,NSError *error){
        
        if (error!=nil)
            {
            return ;
            
            }
        
        
        NSDictionary *dict= [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil]; 
        
        
        NSMutableArray *array=[NSMutableArray array];
        NSMutableArray *array1=[NSMutableArray array];
        for (NSDictionary *d in dict[@"targets"]) 
            {
            [array1 addObject:[d valueForKey:@"_id"]];
            [array addObject:[d valueForKey:@"oid"]];
            }   
        
        self.oidArray =[NSMutableArray arrayWithArray:array];
        self._idArray=[NSMutableArray arrayWithArray:array1];
        
    }];
}
-(void)orderWaitDistributionsworking
{
    NSString *urlString=[NSString stringWithFormat:@"%@/api/zls/orders/topicked?from=f&start=0&count=100",URL];
    NSURL *url=[NSURL URLWithString:urlString];
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
    
    
    [request setHTTPShouldHandleCookies:YES];
    
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *respose,NSData *data,NSError *error){
        if (error!=nil)
            {
            return ;
            }
        
        NSDictionary *dict= [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil]; 
        
        
        NSMutableArray *array=[NSMutableArray array];
        NSMutableArray *array1=[NSMutableArray array];
        for (NSDictionary *d in dict[@"targets"]) 
            {
            [array1 addObject:[d valueForKey:@"_id"]];
            [array addObject:[d valueForKey:@"oid"]];
            }   
        
        self.foidArray =[NSMutableArray arrayWithArray:array];
        self._fidArray=[NSMutableArray arrayWithArray:array1];
        
    }];
    
}
-(void)yudingWorking{
    
    NSString *urlString=[NSString stringWithFormat:@"%@/api/zls/bookOrders/topicked?from=s&start=0&count=100",URL];
    NSURL *url=[NSURL URLWithString:urlString];
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
    
    
    [request setHTTPShouldHandleCookies:YES];
    
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *respose,NSData *data,NSError *error){
        
        if (error!=nil)
            {
            return ;
            
            }
        
        
        NSDictionary *dict= [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil]; 
        
        
        NSMutableArray *array=[NSMutableArray array];
        NSMutableArray *array1=[NSMutableArray array];
        for (NSDictionary *d in dict[@"targets"]) 
            {
            [array1 addObject:[d valueForKey:@"_id"]];
            [array addObject:[d valueForKey:@"oid"]];
            }   
        
        self.ydOidArr =[NSMutableArray arrayWithArray:array];
        self._ydidArr=[NSMutableArray arrayWithArray:array1];
        
    }];
    
    
}
-(void)sendsworking
{
    
}

-(void)waitSendsworking
{
    
}
-(void)cancelssworking
{
    
}
-(void)problemworking
{
    
}
@end
